package org.example.projecttwo.entity.article;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 文章基础信息表
 * </p>
 *
 * @author nn
 * @since 2025-11-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("article")
@Schema(name="Article对象", description="文章基础信息表")
public class Article implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "主键ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "文章编号")
    @TableField("article_no")
    private String articleNo;

    @Schema(description = "文章标题")
    @TableField("title")
    private String title;

    @Schema(description = "文章正文")
    @TableField("content")
    private String content;

    @Schema(description = "封面图片URL")
    @TableField("cover_url")
    private String coverUrl;

    @Schema(description = "分区编码")
    @TableField("partition_code")
    private String partitionCode;

    @Schema(description = "是否为精品文章（0=否，1=是）")
    @TableField("is_featured")
    private Integer isFeatured = 0;

    @Schema(description = "作者用户ID")
    @TableField("author_id")
    private Long authorId;

    @Schema(description = "作者昵称")
    @TableField("author_nickname")
    private String authorNickname;

    @Schema(description = "作者头像URL")
    @TableField("author_avatar")
    private String authorAvatar;

    @Schema(description = "状态（0=草稿、1=待审核、2=审核通过、3=审核未通过、4=已下架、5=已删除）")
    @TableField("status")
    private Integer status;

    @Schema(description = "实际发布时间")
    @TableField("publish_time")
    private LocalDateTime publishTime;

    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "最后编辑时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "删除原因：1-内容违规，2-重复发布，3-作者申请，4-其他原因")
    @TableField("delete_reason")
    private Integer deleteReason;

    @Schema(description = "删除备注")
    @TableField("delete_remark")
    private String deleteRemark;

    @Schema(description = "提交审核时间")
    @TableField("submit_audit_time")
    private LocalDateTime submitAuditTime= null;

    @Schema(description = "审核结束时间")
    @TableField("audit_end_time")
    private LocalDateTime auditEndTime;

    @Schema(description = "审核人")
    @TableField("audit_user")
    private String auditUser;

    @Schema(description = "审核未通过原因")
    @TableField("reject_reason")
    private String rejectReason;

    @Schema(description = "文章下架时间")
    @TableField("off_shelf_time")
    private LocalDateTime offShelfTime;

    @Schema(description = "下架原因：1-内容违规，2-内容过时，3-作者申请，4-其他原因")
    @TableField("off_shelf_reason")
    private Integer offShelfReason;

    @Schema(description = "设为精品时间")
    @TableField("featured_time")
    private LocalDateTime featuredTime= null;

    @Schema(description = "发布策略：1-立即发布，2-定时发布")
    @TableField("publish_strategy")
    private Integer publishStrategy= null;

    @Schema(description = "分区名称")
    @TableField(exist = false)
    private String partitionName;

    @Schema(description = "浏览量")
    @TableField(exist = false)
    private Integer viewCount;

    @Schema(description = "点赞数")
    @TableField(exist = false)
    private Integer likeCount;

    @Schema(description = "收藏数")
    @TableField(exist = false)
    private Integer collectCount;

    @Schema(description = "评论数")
    @TableField(exist = false)
    private Integer commentCount;

    @Schema(description = "是否删除（如0-未删除，1-已删除）")
    @TableField("deleted")
    private Integer deleted;

    @Schema(description = "删除时间")
    @TableField(exist = false)
    private LocalDateTime deleteTime;

    @Schema(description = "下架备注")
    @TableField(exist = false)
    private String offShelfRemark;
}